<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\bootstrap\Alert;
?>
<?php
if( Yii::$app->getSession()->hasFlash('error') ) {
    echo Alert::widget([
        'options' => [
            'class' => 'alert-danger',
            'style' => 'margin-bottom:0px;',
        ],
        'body' => Yii::$app->getSession()->getFlash('error'),
    ]);
}

?>
<div class="col-xs-3 main-left margin-left-0 pull-left ">
    <div>
        <div style="margin:5px 0 0 0;">
            <div class="form-group">
                <div class="row">
                    <div class="col-xs-9"></div>
                    <div class="col-xs-3"></div>
                </div>
            </div>
            <div class="form-group">
                <input type="text" value="" onkeyup="search($(this).val(),2)" class="form-control"
                       placeholder="Search...">
            </div>
            <div class="form-group">
                <div class="col-xs-12">
                    <?= Html::a('新建项目', ['api/add-project'], ['class' => 'btn btn-success pull-right ']) ?>
                </div>
            </div>
            <div class="form-group">
                <div class="list" style="padding-left: 15px">
                    <ul class="list-unstyled">
                        <?php
                        foreach ($data as $key => $value) {
                            ?>
                            <form action="<?= Url::to(['api/delete-project'])?>" method="post">
                                <li class="menu" id="info_1">
                                    <a href="<?= Url::to(['api/api-info', 'id' => $value->projectId, 'apiId' => 0]); ?>">
                                        <span class="glyphicon glyphicon-file"></span>
                                        <?= $value->projectName ?>
                                    </a>
                                    <br>
                                    &nbsp;&nbsp;&nbsp;&nbsp;<?= $value->discribe ?><input type="hidden" name="projectId"
                                                                                          value="<?= $value->projectId ?>">
                                    <br>
                                    <!--只有超级管理员才可以对分类进行操作-->
                                    <div style="float:right;margin-right:16px;">
                                        <button class="btn btn-danger btn-xs" name="op" value="delete"
                                                      onclick="javascript:return confirm('删除后会将该项目下所有接口文档清空，您确认要删除吗?')">删除
                                        </button>
                                        &nbsp;
                                        <a href="<?= Url::to(['api/edit-project','projectId'=>$value->projectId])?>" class="btn btn-info btn-xs" >编辑</a>
                                    </div>
                                    <br>
                                    <hr>
                                </li>
                            </form>
                            <?php
                        }
                        ?>
                    </ul>
                </div>
            </div>

        </div>
    </div>
</div>